package com.xbongbong.saas.domain.dao;

import com.xbongbong.saas.domain.entity.RefundUserEntity;
import com.xbongbong.saas.domain.entity.UserTeamEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

/**
 * @author haibin.zhang
 * @version v1.0
 * @date 2019/4/11 15:15
 * @since v1.0
 */
@Repository
@Mapper
public interface RefundUserDao {

    void insertBatch(@Param("list") List<RefundUserEntity> refundUserEntityList);

    void disbandedTeamByCustomerId(@Param("corpid") String corpid, @Param("customerIdIn") List<Long> customerIdList);

    Integer deleteBatchByRefundIdIn(@Param("corpid") String corpid, @Param("refundIdIn") List<Long> refundIdList);

    Integer update(RefundUserEntity refundUserEntity);

    List<Long> getDataIdList(@Param("corpid") String corpid, @Param("isMain") Integer isMain, @Param("userIdIn") List<String> userIdIn);

    List<UserTeamEntity> findBaseEntitys(@Param("param") Map<String,Object> map);

    List<RefundUserEntity> findEntitys(@Param("param") Map<String,Object> param);

    Integer insert(RefundUserEntity entity);

    /**
     * 根据id查询数据
     *
     * @param key    主键
     * @param corpid 公司ID
     * @return 退货退款实体
     * @author youli.chen
     * @date 2019/1/23 20:00
     * @since v1.0
     **/
    RefundUserEntity getByKey(@Param("key") Long key, @Param("corpid") String corpid);

    /**
     * 根据参数查询满足条件实体集合个数
     *
     * @param param 参数
     * @author youli.chen
     * @return java.lang.Integer
     * @date 2019/2/19 20:33
     */
    Integer getEntitysCount(@Param("param") Map<String, Object> param);

    /**
     * 批量修改
     *
     * @param corpid
     * @param dataIdIn
     * @param isMain
     * @param del
     */
    void batchUpdateByIdIn(@Param("corpid")String corpid, @Param("idIn")List<Long> dataIdIn, @Param("isMain")Integer isMain, @Param("del")Integer del);

    void deleteBatch(@Param("list") List<Long> idList, @Param("corpid") String corpid, @Param("del") Integer del);

    void batchDeleteById(@Param("corpid") String corpid, @Param("idIn") List<Long> removeIdList);

    List<RefundUserEntity> getByRefundId(@Param("corpid") String corpid, @Param("id") Long id);

    void updateBatch(@Param("list") List<RefundUserEntity> refundUserEntityList, @Param("corpid") String corpid);

    /**
     * 批量修改团队里面成员为协同人以及协同人可编辑权限
     *
     * @param corpid
     * @param idIn
     * @param isMain
     * @param formPermission
     */
    void batchUpdateCoAndPerByUserIdIn(@Param("corpid")String corpid, @Param("idIn")List<Long> idIn, @Param("isMain")Integer isMain, @Param("formPermission")Integer formPermission);


}
